package cn.tedu.tmall.admin.mall.dao.persist.repository.impl;

import cn.tedu.tmall.admin.mall.dao.persist.mapper.GoodsDetailMapper;
import cn.tedu.tmall.admin.mall.dao.persist.repository.IGoodsDetailRepository;
import cn.tedu.tmall.admin.mall.pojo.entity.GoodsDetail;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class GoodsDetailRepositoryImpl implements IGoodsDetailRepository {
    @Autowired
    private GoodsDetailMapper mapper;
    @Override
    public int insert(GoodsDetail goodsDetail) {
        return mapper.insert(goodsDetail);
    }

    @Override
    public int deleteByGoodId(Long goodId) {
        QueryWrapper<GoodsDetail> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("goods_id",goodId);
        return mapper.delete(queryWrapper);
    }

    @Override
    public int update(GoodsDetail goodsDetail,QueryWrapper<GoodsDetail> queryWrapper) {
        return mapper.update(goodsDetail,queryWrapper);
    }


}
